package com.qd.common.sys.domain.entity.station;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 人员岗位组织
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@ToString
public class PersonStationOrgDTO extends StationQueryDTO {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "岗位机构和人员关系";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "关系ID"})
    @NotBlank(message = "人员岗位ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "人员岗位ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String personStationId;
    /**
     * 机构ID
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*机构ID"})
    @NotBlank(message = "机构ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "机构ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String orgId;
    /**
     * 机构名称
     */
    @ExcelProperty(value = {EXCEL_TITLE, "机构名称"})
    private String orgIdDisplay;
    /**
     * 职责ID
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*职责ID"})
    @NotBlank(message = "职责ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "职责ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String stationId;
    /**
     * 职责名称
     */
    @ExcelProperty(value = {EXCEL_TITLE, "职责名称"})
    private String stationIdDisplay;
    /**
     * 人员编号
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*人员编号"})
    @NotBlank(message = "人员编号不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "人员编号长度不能超过{max}位", groups = DefaultGroup.class)
    private String personId;
    /**
     * 人员姓名
     */
    @ExcelProperty(value = {EXCEL_TITLE, "人员姓名"})
    private String personIdDisplay;
    /**
     * 添加时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "添加时间"})
    private LocalDateTime addTime;

    @Override
    public void freeData() {
        this.personStationId = null;
        this.orgId = null;
        this.orgIdDisplay = null;
        this.stationId = null;
        this.stationIdDisplay = null;
        this.personId = null;
        this.personIdDisplay = null;
        this.addTime = null;
        super.freeData();
    }
}
